Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSAN error for send_node_id_handshake test #2060

Merged

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented Jun 5, 2019

When running Clang/TSAN I get the following:
https://gist.github.com/wezrule/279062783ed1ed2a2066ba5c79db0b83

What appears to happen is that the last std::shared_ptr<nano::node> reference gets released by an alarm operation which then calls the ~stat destructor. This modifies the map (unprotected) and at the same time a packet is processed and a stat is trying to be incremented. I don't think this is the fault of stats rather the slightly random nature where the last node shared_ptr reference is released which can cause problems in quite a few areas. But as this is the one that TSAN is warning about I have fixed it. Just adding a stop variable/function to prevent modifying stats when closing down the node. Have moved stats higher up the member list as most things have a dependency on it.

@wezrule wezrule added the sanitizers Related to thread, address or undefined sanitizers label Jun 5, 2019
@wezrule wezrule added this to the V19.0 milestone Jun 5, 2019
@wezrule wezrule requested a review from cryptocode June 5, 2019 14:21
@wezrule wezrule self-assigned this Jun 5, 2019
@wezrule wezrule merged commit 4543260 into nanocurrency:master Jun 5, 2019
@wezrule wezrule deleted the send_node_id_handshake_tsan_fix branch June 5, 2019 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sanitizers Related to thread, address or undefined sanitizers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants